package com.jiazhong.servlet.test;

import com.jiazhong.commons.bean.Emp;
import com.jiazhong.servlet.mapper.EmpMapper;
import com.jiazhong.servlet.service.EmpService;
import com.jiazhong.servlet.service.impl.EmpServiceImpl;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;
import java.util.List;

public class App {

    private static void a(){
        InputStream inputStream = App.class.getClassLoader().getResourceAsStream("config.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        EmpMapper empMapper = sqlSession.getMapper(EmpMapper.class);
        List<Emp> emps = empMapper.findAll();
        emps.forEach(System.out::println);
        sqlSession.close();
    }
    private static void b(){
        EmpService service = new EmpServiceImpl();
        /*String s = service.findAll();
        System.out.println(s);*/
    }
    public static void main(String[] args) {
       b();
    }
}
